package com.xiong.proxy;

import com.xiong.proxy.Interceptor.CommonMethodInterceptor;
import net.sf.cglib.proxy.Enhancer;

public class CglibEngine {

    public static <T> T createObj(Class<T> cls){
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(cls);
        enhancer.setCallback(new CommonMethodInterceptor(cls));
        T proxy = (T) enhancer.create();
        return proxy;
    }
}
